﻿/*
 * 
 * Description: Office COMAddins Connector office object library dispatcher
 */
#ifndef OCC_CCOMADDINS_H
#define OCC_CCOMADDINS_H

namespace {
constexpr const DWORD DISPID_CCOMADDINS_GET_APPLICATION = 0x60020000;
constexpr const DWORD DISPID_CCOMADDINS_GET_CREATOR = 0x60020001;
constexpr const DWORD DISPID_CCOMADDINS_ITEM = 0x0;
constexpr const DWORD DISPID_CCOMADDINS_GET_COUNT = 0x1;
constexpr const DWORD DISPID_CCOMADDINS_GET_NEWENUM = 0xfffffffc;
constexpr const DWORD DISPID_CCOMADDINS_UPDATE = 0x2;
constexpr const DWORD DISPID_CCOMADDINS_GET_PARENT = 0x3;
constexpr const DWORD DISPID_CCOMADDINS_SET_APPMODAL = 0x4;
}

class CCOMAddIns : public COleDispatchDriver {
public:
    CCOMAddIns() {}
    CCOMAddIns(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
    CCOMAddIns(const CCOMAddIns &dispatchSrc) : COleDispatchDriver(dispatchSrc) {}

    LPDISPATCH get_Application()
    {
        LPDISPATCH result;
        InvokeHelper(DISPID_CCOMADDINS_GET_APPLICATION, DISPATCH_PROPERTYGET, VT_DISPATCH, (void *)&result, nullptr);
        return result;
    }
    long get_Creator()
    {
        long result;
        InvokeHelper(DISPID_CCOMADDINS_GET_CREATOR, DISPATCH_PROPERTYGET, VT_I4, (void *)&result, nullptr);
        return result;
    }
    LPDISPATCH Item(VARIANT *Index)
    {
        LPDISPATCH result;
        static BYTE parms[] = VTS_PVARIANT;
        InvokeHelper(DISPID_CCOMADDINS_ITEM, DISPATCH_METHOD, VT_DISPATCH, (void *)&result, parms, Index);
        return result;
    }
    long get_Count()
    {
        long result;
        InvokeHelper(DISPID_CCOMADDINS_GET_COUNT, DISPATCH_PROPERTYGET, VT_I4, (void *)&result, nullptr);
        return result;
    }
    LPUNKNOWN get__NewEnum()
    {
        LPUNKNOWN result;
        InvokeHelper(DISPID_CCOMADDINS_GET_NEWENUM, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void *)&result, nullptr);
        return result;
    }
    void Update()
    {
        InvokeHelper(DISPID_CCOMADDINS_UPDATE, DISPATCH_METHOD, VT_EMPTY, nullptr, nullptr);
    }
    LPDISPATCH get_Parent()
    {
        LPDISPATCH result;
        InvokeHelper(DISPID_CCOMADDINS_GET_PARENT, DISPATCH_PROPERTYGET, VT_DISPATCH, (void *)&result, nullptr);
        return result;
    }
    void SetAppModal(BOOL varfModal)
    {
        static BYTE parms[] = VTS_BOOL;
        InvokeHelper(DISPID_CCOMADDINS_SET_APPMODAL, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, varfModal);
    }
};

#endif  // !OCC_CCOMADDINS_H